package PowerWord.UI.GroupWords;

import PowerWord.Core.Plan.Controller;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class PageListAdapter extends BaseAdapter {
   	
	private Context mContext;
	
	public PageListAdapter(Context context) {
		mContext = context;
	}
	
	@Override
	public int getCount() {
		return Controller.Instance().GetCount();
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
        View view = null;
		if (convertView == null) {
			view = new WordItem(mContext);
        } else {
        	view = convertView;
        }
		WordItem wordView = (WordItem)view;
		wordView.UpdateContent(position);
        return view;
	}
}
